package net.wofly.sale.activity.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wofly.sale.commodity.domain.Commodity;
import net.wofly.sale.commodity.domain.CommodityChannel;

/**
 * 活动
 *
 * @author lign
 * @version 1.0
 * @created 01-12月-2017 20:44:13
 */
@Data
@Entity
@Table(name = "sale_activity_activity")
@ApiModel(description = "活动")
public class Activity {
    
    @OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
    @JoinColumn(name = "activityID")
    @ApiModelProperty(value = "礼品列表", required = true)
    private List<ActivityGift> activityGifts;
    @Id
    @ApiModelProperty(value = "活动ID")
    private String activityID;
    @ApiModelProperty(value = "活动名称", required = true)
    private String activityName;
    @ApiModelProperty(value = "活动类型  10:单一商品数量;21:单一订单商品总价 ",allowableValues = "10,21",required = true)
    private Integer activityType;
    /**
     * 达到起始总价
     */
    @ApiModelProperty(value = "达到起始总价", required = false)
    private Integer startAmount;
    /**
     * 达到终止总价
     * -1时，表示无限制
     * 
     */
    @ApiModelProperty(value = "达到终止总价", required = false)
    private Integer endAmount;
    
    @ApiModelProperty(value = "渠道商品ID", required = false)
    private String commodityChannelID;
    @ApiModelProperty(value = "活动结束时间", required = false)
    private Long endTime;
    /**
     * 是否叠加
     */
    @ApiModelProperty(value = "是否叠加", required = false)
    private Integer isSuperposition = 0;
    private Long modifyDate;
    /**
     * 达到的数量
     */
    @ApiModelProperty(value = "达到的数量", required = false)
    private Integer num;
    /**
     * -1 所有订单都适用
     */
    @ApiModelProperty(value = "订单类型(1:会员订单;2:宴会订单;3:签单订单;4:无款订单;5:团购订单;6:订货会订单;7:还货订单;8:渠道订单;)", allowableValues =
            "1,2,3,4,5,6,7,8", required = true)
    private Integer orderType = -1;
    /**
     * 优先级
     */
    @ApiModelProperty(value = "优先级", required = false)
    private Integer priorityLevel;
    @ApiModelProperty(value = "活动开始时间", required = false)
    private Long startTime;
    /**
     * 状态
     * <ul>
     * <li>待生效 有效 下线</li>
     * </ul>
     */
    @ApiModelProperty(value = "状态（ 1:有效 ; -1:下线）", allowableValues = "1,-1", required = false)
    private Integer status = 0;
    
    @Transient
    private CommodityChannel commodityChannel;
    
    @Transient
    private Commodity commodity;
    
    @Transient
    @ApiModelProperty(value = "订单类型", required = false)
    private String orderTypeStr = "";
    @Transient
    @ApiModelProperty(value = "活动类型名称  10:单一商品数量;21:单一订单商品总价 ",allowableValues = "10,21",required = true)
    private String activityTypeStr;
    
    public Activity() {
    
    }
    @Override
    public void finalize() throws Throwable {
    
    }
}